/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package br.com.sigodonto.model.util;

import br.com.sigodonto.model.entity.Clinica;
import br.com.sigodonto.model.entity.Dentista;
import java.io.Serializable;
import javax.faces.context.ExternalContext;
import javax.faces.context.FacesContext;
import javax.servlet.http.HttpSession;

/**
 *
 * @author Fidelis
 */
public class SessionUtil implements Serializable {
    
    public static Dentista carregarDentista(FacesContext context) {
        ExternalContext externalContext = context.getExternalContext();
        HttpSession session = (HttpSession) externalContext.getSession(true);
        Dentista dentista = (Dentista) session.getAttribute("usuario");
        return dentista;
    }

    public static Clinica carregarClinica(FacesContext context) {
        ExternalContext externalContext = context.getExternalContext();
        HttpSession session = (HttpSession) externalContext.getSession(true);
        Clinica clinica = (Clinica) session.getAttribute("clinica");
        return clinica;
    }
    
}
